<?php
namespace app\index\controller;
use \think\Controller;
use \think\View;
use \think\Session;
use \think\Db;
use \think\Request;

class share{
	//政策通知页面
	public function notice(){
		$request = Request::instance();

		$notice_info = Db::name('notice')->alias('n')->join('company c','n.cid = c.cid')->field('n.image,n.title,n.content,n.time,c.cname')->select();

		//var_dump($notice_info);
			return $notice_info;

				}

	//政策通知发布页面
	public function postNotice(){
		$request = Request::instance();

		$cid = $request->param('cid');
		$title = $request->param('title');
		$content = $request->param('content');
		$time = time();
		//数据重组
		$data['cid'] = $cid;
		$data['title'] = $title;
		$data['content'] = $content;
		$data['time'] = $time;

		$res = Db::name('notice')->insert($data);


	}
	//案例美文页面
	public function goodsAticle(){

		$request = Request::instance();

		$goods_info = Db::name('goods_article')->field('image,title,time,num')->select();

		// var_dump($goods_info);
		return $goods_info;

	}
	//案例美文发布
	public function postGoodsArticle(){
		$request = Request::instance();
		$title = $request->param('title');
		$cid   = $request->param('cid');
		$content = $request->param('content');
		$time = time();
		//重组数据
		$data ['cid'] = $cid;
		$data['time'] = $time;
		$data['content'] = $content;
		$data['title'] = $title;

		$post_goods = Db::name('goods_article')->insert($data);
		//var_dump($post_goods);

	}

	//精彩分享团青矩阵页面
	public function youngJuzhen(){

		$request = Request::instance();

		$company_info = Db::name('company')->field('cname,code,parent')->select();

		return $company_info;
	}

	//活动分享页面
	public function activity(){

		$request = Request::instance();

		$share = Db::name('goods_article')->where('is_share = 1')->select();
		//var_dump($share);

		return $share;

	}
		
	
	
}
